{extend name='public/base'} 
{block name='content'}
<style>
    .grid-demo {
        margin: 10px;
        background-color: #009688;
        min-height: 740px;
        color: #ffffff;
    }
    .left-one{
        padding: 10px;
    }
    .left-tow{
        line-height: 22px;
        padding: 5px 12px 5px 12px;
        
    }
    .right{
        padding: 10px;
        margin-top: 10px;
        background-color: #ffffff;
        min-height: 740px;
    }
    .la_name{
        font-size: 24px;
        text-align: center;
        width: 100%
    }
    .layui-tab-brief>.layui-tab-title .layui-this {
        color: #3ad8c9;
    }
    .layui-tab-title {
        height: 60px;
    }
    .layui-tab-title li {
        line-height: 60px;
    }
    .layui-tab-title .layui-this:after {
        height: 59px;
    }
    .layui-tab-brief>.layui-tab-more li.layui-this:after, .layui-tab-brief>.layui-tab-title .layui-this:after {
        border-bottom: 5px solid #5FB878;
    }
    .layui-form-label { 
        width: 100px;
    }
    .btn-left{
        margin-left: 10%;
    }
    .layui-tab-bar {
        background-color: #009688;
    }
    .bl-background{
        margin: auto;
        width: 100%;
        background: #017369;
    }
</style>

<!-- Content Header (Page header) -->
<section class="content-header">
    <h1>
        {$item['item1']}
        <small>{$item['item2']}</small>
    </h1>
    <ol class="breadcrumb">
        <li>
            <a href="#">
                <i class="fa fa-dashboard"></i> {$item['item1']}</a>
        </li>
        <li class="active">{$item['item2']}</li>
    </ol>
</section>

<!-- Main content -->
<div class="layui-row layui-col-space5">
    <div class="layui-col-md12">
      <div class="layui-row">
        <div class="layui-col-md2">
          <div class="grid-demo ">
            <div class="left-one">
                <image style="width: 100%;height: auto;" src="/static/AdminLTE/dist/img/avatar5.png"></image>
            </div>
            <div class="left-one">
                <label class="la_name">{$data.patientInfo.name}</label>
                <button  onclick="click_cases()" class="layui-btn layui-btn-sm bl-background">历史病例</button>
            </div>
            <div class="left-tow">电话：{$data.patientInfo.phone}</div>
            <div class="left-tow">性别：
                {switch name="$data.patientInfo.sex"}
                    {case value="1"}男{/case}
                    {case value="2"}女{/case}
                    {default /}不详
                {/switch}
            </div>
            <div class="left-tow">年龄：{$data.patientInfo.age}</div>
            <div class="left-tow">身高：{$data.patientInfo.height}</div>
            <div class="left-tow">体重：{$data.patientInfo.weight}</div>
            <div class="left-tow">血型：{$data.patientInfo.blood}</div>
            <div class="left-tow">出生年月：{$data.patientInfo.birth}</div>
            <div class="left-tow">身份证：{$data.patientInfo.idcard}</div>
            <div class="left-tow">住址：{$data.patientInfo.address}</div>
            <div class="left-tow">微信：{$data.patientInfo.wechat}</div>
            <div class="left-tow">邮箱：{$data.patientInfo.email}</div>
          </div>
        </div>
        <div class="layui-col-md10">
            <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief" >
                <ul class="layui-tab-title  layui-bg-green">
                  <li class="layui-this">诊断病例</li>
                  <li>开具处方</li>
                  <li>检查治疗</li>
                  <li>其他收费</li>
                  <li>报告</li>
                </ul>
                <div class="layui-tab-content" style="min-height: 680px;background: #ffffff">
                  <div class="layui-tab-item layui-show">
                        <form action="{:url('merchant/diagnosis/cases')}" class="layui-form layui-form-pane" id="mainForm" method="post">
                        <input type="text" name="id" id="id" value="{$data.recordsInfo.id}"  class="layui-input"> 
                        <div class="layui-form-item">
                            <label class="layui-form-label">发病日期</label>
                            <div class="layui-input-block">
                                <input type="text" name="onset" id="onset" value="{$data.recordsInfo.onset}" lay-verify="date" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">主诉</label>
                            <div class="layui-input-block">
                                <textarea name="talk" id="talk" class="layui-textarea">{$data.recordsInfo.talk}</textarea>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">初步诊断</label>
                            <div class="layui-input-block">
                                <input type="text" name="diagnosis" id="diagnosis" value="{$data.recordsInfo.diagnosis}" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">现病史</label>
                            <div class="layui-input-block">
                                <input type="text" name="now" id="now" value="{$data.recordsInfo.now}" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">既往史</label>
                            <div class="layui-input-block">
                                <input type="text" name="old" id="old" value="{$data.recordsInfo.old}" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">过敏史</label>
                            <div class="layui-input-block">
                                <input type="text" name="allergy" id="allergy" value="{$data.recordsInfo.allergy}" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">治疗意见</label>
                            <div class="layui-input-block">
                                <input type="text" name="opinion" id="opinion" value="{$data.recordsInfo.opinion}" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">备注</label>
                            <div class="layui-input-block">
                                <input type="text" name="remark" id="remark" value="{$data.recordsInfo.remark}" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <button class="layui-btn" type="submit">保存</button>
                        <button style="display: none;"  type="reset" class=" layui-btn layui-btn-primary">重置</button>
                        <button onclick='pushXX()' style="display: none" class="layui-btn layui-btn-sm">测试通知</button>
                    </form>
                  </div>
                  <div class="layui-tab-item">内容2</div>
                  <div class="layui-tab-item">内容3</div>
                  <div class="layui-tab-item">内容4</div>
                  <div class="layui-tab-item">内容5</div>
                </div>
            </div>
        </div>
      </div>
    </div>
  </div>
<!-- /.content -->


{/block} {block name='script'}
<script>
    //增加数据
    $(function () {
        //表格功能
        $('#example1').DataTable({
            'paging': true,
            'lengthChange': true,
            'searching': true,
            'ordering': false,
            'info': true,
            'autoWidth': true
        });


        //JQuery里面的方法,ajaxSubmit来提交表单
        var options = {
            type: 'post', //post提交
            //url:'http://ask.tongzhuo100.com/server/****.php?='+Math.random(),   //url
            dataType: "json", //json格式
            data: {}, //如果需要提交附加参数，视情况添加
            clearForm: false, //成功提交后，清除所有表单元素的值
            resetForm: false, //成功提交后，重置所有表单元素的值
            cache: false,
            async: false, //同步返回
            success: function (data) {
                console.log(data);
                if (data.code == 0) {
                    layer.msg(data.msg, {
                        icon: 2,
                        offset: 'm',
                        time: 1000
                    });
                } else {
                    layer.msg(data.msg, {
                        icon: 1,
                        offset: 'm',
                        time: 1500
                    }, function () {
                        // location.reload();
                    });
                }
                //服务器端返回处理逻辑
            },
            error: function (XmlHttpRequest, textStatus, errorThrown) {
                layer.msg('操作失败:服务器处理失败');
            }
        };

        layui.use('form', function(){
            var form = layui.form;
            $('#mainForm').ajaxForm(options).submit(function(data){});
        });

    })
    //新增用户的模态框数据清除
    $("#addModal,#editModal").on('hide.bs.modal', function () {
        $('#addReset').click();
    });
    //加载缓冲动画
    $("#addModal,#editModal").on('show.bs.modal', function () {
        layer.closeAll();
    });


    //推送通知
    function pushXX() {
        layer.confirm("是否发送通知",{
          btn: ['确定','取消'] //按钮
        },function(){
          $.post('{:url("merchant/Diagnosis/pushAString")}', {}, function(data, textStatus, xhr) {
              console.log(data)
            /*optional stuff to do after success */
            if(data.code==0){
              layer.msg(data.msg);
            }else{
              layer.msg(data.msg,{icon:1,time:800},function(){
                location.reload();
              });
            }
          });
        }); 
    }


    //历史病例
    function click_cases(){
        lotus_show('历史病例',"<?php echo url('merchant/diagnosis/cases_history'); ?>?id={$data.patient_id}",800,600);
    }

</script>

<script>
    layui.use('laydate', function(){
        var laydate = layui.laydate;
        //日期
        laydate.render({
        elem: '#onset'
        });
    });
</script>
{/block}